package com.kaifamiao.www.demo.do0826;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class Demo04 {
    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        // <<倚天屠龙记>>
        list.add("张无忌");
        list.add("周芷若");
        list.add("赵敏");
        list.add("张三");
        list.add("张三丰");
        Stream<String> stream = list.stream();
        //<<天龙八部>>
        Stream<String> stream1 = Stream.of("张三", "萧峰", "段誉", "王语嫣", "虚竹");
        Stream<String> concat = Stream.concat(stream,stream1);

        Map<String,Integer> list1 = concat
                .distinct()//去掉重复
                .filter(s -> s.startsWith("张"))
                .collect(Collectors.toMap(s -> s,s ->  s.length()));
        System.out.println(list1);
    }
}
